<template>
  <div :class="{'header-fixed':is_fixed }">
    <!--  
      navData.left_text 返回右侧文字
      navData.title 标题
      navData.right_text 右侧文字
    -->
    <van-nav-bar :class="{'Header-wrap': true,'fixed':is_fixed }" :left-text="data.leftText|| ''" :title="data.title || ''"  :right-text="data.rightText || ' '" left-arrow  @click-left="navback()" />
  </div>
</template>

<script>
import { truncate } from 'fs';
export default {
  name: 'Header',
  data(){
    return {
      is_navData: true,
      is_fixed: false,
      data:{}
    }
  },
  props:{
    navData: Object || '{}'
  },
  methods:{
    navback(){
      this.$router.go(-1);
    }
  },
  created(){
    this.data = this.$attrs;
    if(typeof(this.data.fixed)  == "undefined"){
      this.is_fixed = false
    }else {
      this.is_fixed = true
    }
  }
}
</script>
<style scoped>
.Header-wrap {
  top:0;
  left: 0;
  right:0;
  z-index: 2;
}
.fixed {
  position: fixed!important;
}
.header-fixed {
  height: 50px;
}
</style>
